{extend name="public/base"}

{block name="title"}修改网站信息配置{/block}

{block name="main"}
<!--添加用户UI-->
<div class="layui-row">
    <div class="layui-col-md4 layui-col-md-offset4">
        <form action="{:url('/info/'.$obj.id)}" method="post" class="layui-form layui-form-pane admin-form">
            <input type="hidden" name="_method" value="put">
            <div class="layui-form-item layui-form-text" >
                <label for="title" class="layui-form-label">网站标题(支持html语句)</label>
                <div class="layui-input-block">
                    <textarea name="title" id="title"  placeholder="请输入内容(支持html语句)" class="layui-textarea">{$obj.title}</textarea>
                </div>
            </div>
            <div class="layui-form-item layui-form-text" >
                <label for="key" class="layui-form-label">网站SEO关键词</label>
                <div class="layui-input-block">
                    <textarea name="key" id="key"  placeholder="请输入内容" class="layui-textarea">{$obj.key}</textarea>
                </div>
            </div>
            <div class="layui-form-item layui-form-text" >
                <label for="des" class="layui-form-label">网站SEO描述</label>
                <div class="layui-input-block">
                    <textarea name="des" id="des"  placeholder="请输入内容" class="layui-textarea">{$obj.des}</textarea>
                </div>
            </div>
            <div class="layui-form-item">
                <label for="logo" class="layui-form-label">网站LOGO</label>
                <div class="layui-input-block">
                    <button type="button" class="layui-btn layui-btn-fluid" id="test1">
                        <i class="layui-icon">&#xe67c;</i>上传图片
                        <input type="hidden"  name="logo" id="logo">
                    </button>
                </div>
            </div>
            <div class="layui-form-item">
                <div class="layui-col-md12">
                    <img src="{$obj.logo}" width="100%" height="120px"  class="layui-upload-img" id="demo1" alt="这是LOGO">
                </div>
            </div>
                    <input type="hidden" value="{:token()}" name="__token__">
                    <button class="layui-btn layui-btn-success layui-btn-fluid layui-btn-lg">提交修改</button>

        </form>
    </div>
</div>
<script>
    layui.use(['upload','layer','jquery','form'], function(){
        var upload = layui.upload,
            layer = layui.layer,
            $=layui.$;

        //执行实例
        var uploadInst = upload.render({
            elem: '#test1' //绑定元素
            ,url: "{:url('index/upload')}" //上传接口
            ,field:'image'
            ,accept: 'image'
            ,acceptMime:'image/*'
            ,before:function (obj) {
                //预读本地文件示例，不支持ie8
                obj.preview(function(index, file, result){
                    $('#demo1').attr('src', result); //图片链接（base64）
                });
                layer.msg('上传中', {icon: 16, time: 0});
            }
            ,done: function(res){
                //上传完毕回调
                if (res.code===200){
                    layer.msg(res.msg,{
                        icon:1
                    })
                    $('#logo').val(res.path)
                }else{
                    layer.msg(res.msg,{
                        icon:2
                    })
                }
            }
            ,error: function(){
                //请求异常回调
            }
        });
    });
</script>
{/block}